<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>银行卡</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <style>
        .cart-item {
            height: 7.5rem;
            margin: .6rem;
            box-shadow: 0px 2px 20px 0px rgba(0, 0, 0, 0.1);
            border-radius: .5rem;
            color: #fff;
            padding: 1.25rem .6rem 1rem 1.2rem;
            position: relative;
        }

        .moren-img {
            position: absolute;
            left: 0;
            top: 0;
            height: 1.75rem;
            width: 1.75rem
        }

        .blue-bg {
            background: linear-gradient(to right, #59A0FC, #3184F3);
        }

        .red-bg {
            background: linear-gradient(to right, #FF8C71, #F85063);
        }

        .bank-img {
            height: 1.75rem;
            width: 1.75rem;
            margin-right: .6rem
        }

        .btn {
            background: #FFFFFF;
            width: 2.4rem;
            height: 1.15rem;
            line-height: 1.15rem;
            border-radius: .75rem;
            text-align: center;
            opacity: 0.2
        }

        .btn-text {
            position: absolute;
            top: .15rem;
            left: .5rem
        }

        .white-dian {
            height: .25rem;
            width: .25rem;
            border-radius: 50%;
            margin-right: .25rem;
            background: #fff
        }

        .white-dian:nth-child(4n) {
            margin-right: 1rem
        }

        .card-num {
            margin: 1.95rem 2.95rem 1rem
        }
        .add-card{
          flex-direction: column;
        }
    </style>
</head>

<body>

    <section>
        <div id='app'>
            <div class="font-14 text-color-3 cart-item blue-bg" v-for='item in cardList'>
                <div class="flex-just-between">
                    <div class="flex-align-center">
                        <img class='bank-img' :src="item.img" alt="">
                        <div>
                            <div class="font-18">
                                {{item.bankName}}
                            </div>
                            <div class="font-12">{{item.cardType}}</div>
                        </div>
                    </div>
                    <div style="position:relative" v-if='item.id == 0' tapmode @click='unbundling'>
                        <div class="btn font-12"></div>
                        <span class="btn-text">解绑</span>
                    </div>
                </div>
                <div class="card-num flex-align-center">
                    <div class="white-dian" v-for='index of 12'>
                    </div>
                    <div class="font-18">
                        {{item.cardNum}}
                    </div>
                </div>
                <img class='moren-img' v-if='item.id == 0' src="../../image/merchant/moren.png" alt="">
            </div>
            <div class="font-14 text-color-3 cart-item add-card flex-center" @click='toAddCard'>
              <img class='img-64' src="../../image/merchant/add-img.png" alt="">
              <div class="text-color-3">
                添加银行卡
              </div>
            </div>
        </div>
    </section>

</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript " src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js "></script>
<script type="text/javascript">
    var vm = new Vue({
        el: '#app',
        data: {
            cardList: [{
                id: 0,
                img: '../../image/merchant/jsyh-logo.png',
                bankName: '中国建设银行',
                cardType: '储蓄卡',
                cardNum: 1234,
                type: 0
            }, {
                id: 1,
                img: '../../image/merchant/jsyh-logo.png',
                bankName: '中国银行',
                cardType: '信用卡',
                cardNum: 4567,
                type: 1
            }]
        },
        methods: {
        toAddCard:function(){
          // 如果还未实名认证就弹出弹窗提示
          api.confirm({
              title: '实名认证',
              msg: '为保证资金安全，添加银行卡需要先进行实名认证',
              buttons: ['去认证', '取消']
          }, function(ret, err){
              if( ret ){
                api.openFrame({
                    name: 'add-card_win',
                    url: './add-card_win.html',
                    rect: {
                        x: 0,
                        y: 0,
                        w: api.winWidth,
                        h: api.winHeight
                    },
                    pageParam: {
                        name: 'test'
                    },
                    bounces: true,
                    bgColor: 'rgba(0,0,0,0)',
                    vScrollBarEnabled: true,
                    hScrollBarEnabled: true
                });
              }else{
                   alert( JSON.stringify( err ) );
              }
          });
        },
        unbundling:function(){
          api.confirm({
              title: '',
              msg: '确定解绑该银行卡？',
              buttons: ['确定', '取消']
          }, function(ret, err){
              if( ret ){
                   alert( JSON.stringify( ret ) );

              }else{
                   alert( JSON.stringify( err ) );
              }
          });

        }
        }
    });
    apiready = function() {

    };
</script>

</html>
